package com.sddnytsh.body_buildingsystem.components

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import com.sddnytsh.body_buildingsystem.BottomViewModel
import com.sddnytsh.body_buildingsystem.R

@Composable
fun BottomBarContent(selected: Int, navController: NavController, onSelectedChange: (Int) -> Unit) {
    Row(Modifier.background(Color.White)) {
        TabItem(
            if (selected == 0) R.drawable.home else R.drawable.homeoutline,
            "首页",
            if (selected == 0) Color.Green else Color.Black,
            Modifier
                .weight(1f)
                .clickable {
                    onSelectedChange(0)
                }
        )
        TabItem(
            if (selected == 1) R.drawable.health else R.drawable.healthoutline,
            "健康",
            if (selected == 1) Color.Green else Color.Black,
            Modifier
                .weight(1f)
                .clickable {
                    onSelectedChange(1)
                }
        )

        TabItem2(
            R.drawable.add,
            "",
            Color.White,
            Modifier
                .weight(0.6f)
                .clickable {
                    navController.navigate("createPost")
                }
        )

        TabItem(
            if (selected == 2) R.drawable.message else R.drawable.messageoutline,
            "消息",
            if (selected == 2) Color.Green else Color.Black,
            Modifier
                .weight(1f)
                .clickable {
                    onSelectedChange(2)
                }
        )
        TabItem(
            if (selected == 3) R.drawable.person else R.drawable.personoutline,
            "我的",
            if (selected == 3) Color.Green else Color.Black,
            Modifier
                .weight(1f)
                .clickable {
                    onSelectedChange(3)
                }
        )
    }
}
